/*
 * Created on Jun 23, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package org.peterrussell.contractionTimer;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Graphics;

import org.peterrussell.contractionTimer.view.UIHelper;

/**
 * @author peterr
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class MainCanvas extends Canvas {

	/**
	 * 
	 */
	private long contactionTime;
	private long betweenContactionTime;
	public Command exitCommand;
	public Command startCommand;
	public Command stopCommand;
	public Command helpCommand;
	
	public MainCanvas() {
        //helpCommand = new Command("Help", Command.HELP, 2);
        exitCommand = new Command("Exit", Command.EXIT, 1);
        startCommand = new Command("Start", Command.ITEM, 2);
        stopCommand = new Command("Stop", Command.ITEM, 2);
        //ticker = new Ticker("Don't forget to have your bags packed in plenty of time.");
        this.addCommand(exitCommand);
        this.addCommand(startCommand);
        //canvas.addCommand(helpCommand);
        this.setCommandListener(new MainCanvasListener());
        //form.setTicker(ticker);

	}

	/* (non-Javadoc)
	 * @see javax.microedition.lcdui.Displayable#paint(javax.microedition.lcdui.Graphics)
	 */
	 public void paint (Graphics g) {
	    g.setGrayScale (255);
	    g.fillRect (0, 0, getWidth (), getHeight ());
	    g.setGrayScale (0);
	    g.drawString("Contraction Time:"+UIHelper.dateToString(contactionTime),10,10,0);
	    g.drawString("Interval Time:"+UIHelper.dateToString(betweenContactionTime),10,30,0);
	    
	  }
	 
	 



	/**
	 * @return Returns the betweenContactionTime.
	 */
	public long getBetweenContactionTime() {
		return betweenContactionTime;
	}
	/**
	 * @param betweenContactionTime The betweenContactionTime to set.
	 */
	public void setBetweenContactionTime(long betweenContactionTime) {
		this.betweenContactionTime = betweenContactionTime;
	}
	/**
	 * @return Returns the contactionTime.
	 */
	public long getContactionTime() {
		return contactionTime;
	}
	/**
	 * @param contactionTime The contactionTime to set.
	 */
	public void setContactionTime(long contactionTime) {
		this.contactionTime = contactionTime;
	}
}
